#include <bits/stdc++.h>
using namespace std;
int t[100010];
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    for(int i = 1;i <= 100000;i++) t[i] = 0;
    int n;
    cin >> n;
    for(int i = 1;i <= n;i++){
        int a;
        cin >> a;
        t[a]++;
    }
    int ans = 0,anspl = 0;
    for(int i = 1;i <= 99999;i++){
        int cnt = i + 1;
        while(t[i] > 0){
            if(t[cnt] > 0){
                  t[i]--;
                  anspl++;
                  t[cnt]--;
            }
            else if(cnt < 99999) cnt++;
            else break;
        }
        ans += t[i];
    }
    if(n % 2 == 0) cout << ans + anspl << endl;
    else cout << ans + anspl - 1 << endl;
    return 0;
}
